<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>注册页面</title>
  </head>
    <script type="text/javascript" src="${staticWebsite}js/jquery-1.7.2.min.js"></script>
  <script type="text/javascript">
		 $(document).ready(function() {
		    $("#sub").click(function(){
		        var email=$("#email").val();
			    var password=$("#password").val();
			    var year=$("#year").val();
			    var month=$("#month").val();
			    var day=$("#day").val();
			    var state=$("#state").val();
				var pattern1 = /^[0-9a-zA-Z_\-\.]+@[0-9a-zA-Z_\-]+(\.[0-9a-zA-Z_\-]+)+$/;
				var pattern2 = /^[0-9a-zA-Z_\-\*]+$/;
				if(!pattern1.test(email)){
					alert("用户名格式不正确  ！");
					return false;
				}
				else if(!pattern2.test(password)){
					alert("输入密码格式不正确！");
					return false;
				}
				else if(year==0){
					alert("请选择出生年份！");
					return false;
				}
				else if(month==0){
					alert("请选择出生月份！");
					return false;
				}
				else if(day==0){
					alert("请选择出生日！");
					return false;
				}
				else if(state==0){
					alert("请选择状态！");
					return false;
				}
			        $("#registerForm").submit();
		    });
		 });
	</script>
  <body>
  <form method="post" id="registerForm" action="${website}login/login_register.action">
<p>
<label for="email">注册邮箱:</label>
<input type="text" name="user.email" id="email"/>
</p>
<p>
<label for="password">创建密码:</label>
<input type="password" id="password" name="user.password"/>
</p>
<p>
<label for="realName">真实姓名:</label>
<input type="text" id="realName" name="user.realName"/>
</p>
<p>
<label for="sex">&nbsp;&nbsp;&nbsp;&nbsp;性别:</label>
男<input type="radio" name="user.sex" checked="checked" value="1"/>女<input type="radio" name="user.sex" value="0"/>
</p>
<p>
<label for="birth">&nbsp;&nbsp;&nbsp;&nbsp;生日:</label>
   <select id="year" name="year">
     <option value="0">请选择</option>
     <c:forEach items="${yearList}" var="i">
      <option value="${i.yearName}">${i.yearName}</option>
     </c:forEach>
   </select>
     年
    <select id="month" name="month">
     <option value="0">--</option>
     <c:forEach items="${monthList}" var="i">
      <option value="${i.monthName}">${i.monthName}</option>
     </c:forEach>
   </select>
     月
   <select id="day" name="day">
     <option value="0">--</option>
     <c:forEach items="${dayList}" var="i">
      <option value="${i.dayName}">${i.dayName}</option>
     </c:forEach>
   </select>
     日
</p>
<p>
<label for="state">&nbsp;&nbsp;&nbsp;我现在:</label>
<select id="state" name="user.state">
     <option value="0">请选择身份</option>
     <option value="1">已经工作了</option>
     <option value="2">正在上大学</option>
     <option value="3">正在上高中</option>
     <option value="4">是其他身份</option>
   </select>
   (非常重要)
</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="image" id="sub" src="${staticWebsite}image/login/registerNow.jpg" >
</p>
</form>

  </body>
</html>
